/***************************************************************************
 *   Copyright (C) 2009 by Bernhard Neuhofer   *
 *   mail@bneu.at   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef TAXISTANDSQTWADAPTER_H
#define TAXISTANDSQTWADAPTER_H
#include "sqtwAdapter.h"
#include "modelentity.h"
#include "memento.h"

/**
* @brief SQTW Adapter for the TaxiStand ME.
*/
class TaxiStandSqtwAdapter:public SqtwAdapter
{
public:
	/**
	* @see RollbackableAdapter#createMemento
	*/
	Memento* createMemento(ModelEntity* modelentity);

	/**
	* @see RollbackableAdapter#setMemento
	*/
	void setMemento(ModelEntity* modelentity,Memento* memento);

	/**
	* The default queue is zero, only TaxiArrival messages are queued in queue 1
	*/
	unsigned int intoWhichQueue(Message* message);

	/**
	* @see SqtwAdapter#outOfWhichQueue
	*/
	unsigned int outOfWhichQueue(ModelEntity* modelEntity);
private:

	/**
		* The memento is defined as a nested class here. Ir would be more in the
		* spirit of the memento pattern to define it as inner class of the model
		* entity but as we have to keep in mind that there ca be different
		* simulation strategies with different demands on the knowledge about
		* the ME this is the best we can do
		*/
	class TaxiStandSqtwMemento:public Memento
	{
	private:
	/** The number of customers waiting at the taxistand */
	 unsigned int _nrCustomers;
	public:
	/**
	 *        Constructs a memento with the given number of customers.
	 * @param nrCustomers Number of waiting customers
	 */
	TaxiStandSqtwMemento(unsigned int nrCustomers);

	/**
	 *        Get the number of waiting customers
	 * @return nrCustomer The number of waiting customers
	 */
	virtual unsigned int getNrCustomers();

	/**
	 *        Set the number of waiting customers
	 * @param nrCustomers The number of customers
	 */
	virtual void setNrCustomers(unsigned int nrCustomers);
	};
};

#endif